package sun.cn.validate.context.parser;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
import org.w3c.dom.Element;

import sun.cn.validate.holder.ValidateHolder;

/**
 * 
 * @author sunlingao
 * @title
 * @date 2017年11月17日
 * @version
 */
public class ValidateHolderDefinitionParser extends AbstractSingleBeanDefinitionParser{
	
	@Override
	protected Class<?> getBeanClass(Element element) {
		return ValidateHolder.class;
	}
	
	@Override
	protected void doParse(Element element, BeanDefinitionBuilder builder) {
		String name = element.getAttribute("name");
		if(StringUtils.isNotEmpty(name)){
			builder.addPropertyValue("name", name);
		}
	}
	
}
